package school;
import java.util.ArrayList;

public class Teacher {

	
	private static StringBuffer teacherName = new StringBuffer("Lola");
	private static Student student = new Student();
	private static int totalPoint = 200; 
	
	public void setStudent(Student st){
		
		student = st;
	}
	
	public Student getStudent(){
		
		return student;
	}
	
	public StringBuffer getTeacherName(){
		
		return teacherName;
	}
	
	private static void testGrade(Student student){
				
		if ((student.getHomeWork() >= 3.6)&&(student.getFinalTest() >=50)){
			
			System.out.println("Grades  Acceptable");
		
		}else if ((student.getHomeWork() >= 3.0)&&(student.getFinalTest() >=60)){
			
			System.out.println("Grades  Acceptable");
			
		}else if ((student.getHomeWork() >= 2.6)&&(student.getFinalTest() >=70)){
			
			System.out.println("Grades  Acceptable");
			
		}else if ((student.getHomeWork() >= 2.0)&&(student.getFinalTest() >=80)){
			
			System.out.println("Grades  Acceptable");
		
		}else
			
			System.out.println("Please see your counselor");
			
	}
	
	private void pointEarned(Student student){
		
		int score = student.getPointEarned() * 100 / totalPoint;
		
		if(score >= 90){
			
			System.out.println("Congratulations. You have 'A'");
			student.setStudentGrade("Promoved to Next");			
			
		}else if(score >= 80){
			
			System.out.println("Congratulations. You have 'B'");
			student.setStudentGrade("Promoved to Next");
			
		} else if(score >= 75){
			
			System.out.println("Congratulations. You have 'C'");
			student.setStudentGrade("Promoved to Next but need to Study");
			
		}else if(score >= 70){
			
			System.out.println("Congratulations. You have 'D'");
			student.setStudentGrade("Promoved to Next a Chepa!");
			
		}else 
			
			System.out.println("Sorry. You arent' promoved!!");
		}
	
	public Teacher(){
	}
		
	public static void main(String [] args){

		ArrayList <Teacher> aTeacher = new ArrayList <Teacher>();
		ArrayList <Student> aStudent = new ArrayList <Student>(); 
		Teacher t1 = new Teacher();
		Student s1 = new Student();
				
		s1.setStudentName("Rudy Matos");
		s1.setStudentGrade("College");
		s1.setHomeWFinalT(3.6, 50);
		s1.setPointEarned(180);
		aStudent.add(s1);
		System.out.println("Student Name.: "+s1.getStudentName()+"\n"+"Student Grade.: "+s1.getStudentGrade());
		
		t1.setStudent(s1);
		aTeacher.add(t1);
		
		aTeacher.get(0).testGrade(aStudent.get(0));
		aTeacher.get(0).pointEarned(aStudent.get(0));
		System.out.println(aStudent.get(0).getStudentGrade());
		
		//New Student
		s1 = new Student();
		s1.setStudentName("Richard Ravelo");
		s1.setStudentGrade("College");
		s1.setHomeWFinalT(1.8, 80);
		s1.setPointEarned(140);
		aStudent.add(s1);
		System.out.println("Student Name.: "+s1.getStudentName()+"\n"+"Student Grade.: "+s1.getStudentGrade());
		
		t1.setStudent(s1);
		aTeacher.add(t1);
		
		aTeacher.get(1).testGrade(aStudent.get(1));
		aTeacher.get(1).pointEarned(aStudent.get(1));
		System.out.println(aStudent.get(1).getStudentGrade());
	}
}
